﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace Mazeball
{
    class Ball : IRenderable
    {
        public Color Color { get; private set; }

        public bool IsSelected { get; set; }

        public GridCell Cell { get; private set; }

        private float _size;
        //public Point Position { get; set; }
        
        //public Pen Pen { get; set; }
        public Brush Brush { get; set; }

        public Ball(Brush brush, GridCell cell)
        {
            Brush = brush;
            Cell = cell;
        }

        public void Render(Rectangle rect, Graphics g)
        {
            _size = Game.Grid.CellSize * GameSettings.BallSize;
            var offset = (Game.Grid.CellSize - _size) * 0.5f;
            //Position = Cell.Position + (Game.Grid.CellSize - _size)*0.5;
            var x = Cell.x + offset;
            var y = Cell.y + offset;

            g.FillEllipse(Brush, (int)x, (int)y, (int)_size, (int)_size);
            var pen = IsSelected ? ColorManager.SelectedBallPen : ColorManager.NormalBallPen;
            g.DrawEllipse(pen, (int) x, (int) y,(int) _size,(int) _size);
        }

    }
}
